﻿using System;
using System.Windows.Forms;

namespace GameListEditor
{
    ///-------------------------------------------------------------------------------------------------
    /// <summary> Form used to select files necessary for database creation. </summary>
    ///-------------------------------------------------------------------------------------------------
    public partial class FormDatabaseCreation : Form
    {
        ///-------------------------------------------------------------------------------------------------
        /// <summary> Initializes a new instance of the <see cref="T:System.Windows.Forms.Form" /> class. </summary>
        ///-------------------------------------------------------------------------------------------------
        public FormDatabaseCreation()
        {
            InitializeComponent();
        }

        ///-------------------------------------------------------------------------------------------------
        /// <summary> Event handler. Called by BTN_SelectListXMLFile for click events. </summary>
        /// <param name="sender"> Source of the event. </param>
        /// <param name="e"> Event information. </param>
        ///-------------------------------------------------------------------------------------------------
        private void BTN_SelectListXMLFile_Click(object sender, EventArgs e)
        {
            openFileDialog.FileName = EDT_ListXML.Text;
            openFileDialog.Filter = "Files (*.xml;*.exe)|*.xml;*.exe|All Types (*.*)|*.*";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
                EDT_ListXML.Text = openFileDialog.FileName;
        }

        ///-------------------------------------------------------------------------------------------------
        /// <summary> Event handler. Called by BTN_SelectCatVerFile for click events. </summary>
        /// <param name="sender"> Source of the event. </param>
        /// <param name="e"> Event information. </param>
        ///-------------------------------------------------------------------------------------------------
        private void BTN_SelectCatVerFile_Click(object sender, EventArgs e)
        {
            openFileDialog.FileName = EDT_CatVer.Text;
            openFileDialog.Filter = "Ini Files (*.ini)|*.ini|All Types (*.*)|*.*";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
                EDT_CatVer.Text = openFileDialog.FileName;
        }

        ///-------------------------------------------------------------------------------------------------
        /// <summary> Gets the source file (listXML or mame executable.) </summary>
        /// <returns> The source file. </returns>
        ///-------------------------------------------------------------------------------------------------
        public String GetSourceFile()
        {
            return (EDT_ListXML.Text);
        }

        ///-------------------------------------------------------------------------------------------------
        /// <summary> Gets the selected catVer file. </summary>
        /// <returns> The catVer file. </returns>
        ///-------------------------------------------------------------------------------------------------
        public String GetCatVerFile()
        {
            return (EDT_CatVer.Text);
        }
    }
}
